package com.fanrenqiji.entity;

import lombok.Getter;
import lombok.Setter;
import org.hibernate.annotations.CacheConcurrencyStrategy;

import javax.persistence.*;
import java.sql.Timestamp;

/**
 * Created by yanwt on 2017/3/31.
 */
@Entity
@Table(name = "tb_phone_code")
@org.hibernate.annotations.Table(appliesTo = "tb_phone_code",comment = "手机验证码")
@org.hibernate.annotations.DynamicInsert
@org.hibernate.annotations.DynamicUpdate
@org.hibernate.annotations.Cache(region="phone_code", usage = CacheConcurrencyStrategy.READ_WRITE)
public class PhoneCodeEntity {
    @Id
    @GeneratedValue(strategy= GenerationType.IDENTITY)
    private Long id;

    @Column(columnDefinition=("varchar(20) default null comment '手机号'"))
    private String phone;

    @Column(columnDefinition=("varchar(8) default null comment '验证码'"))
    private String code;

    @Column(name="send_time",columnDefinition=("datetime default null comment '发送时间'"))
    private Timestamp sendTime;

    @Column(name="valid_time",columnDefinition=("datetime default null comment '有效时间'"))
    private Timestamp validTime;

    @Column(name="max_times",columnDefinition = ("int(11) default null comment '最大次数'"))
    private int maxTimes;

    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    public String getPhone() {
        return phone;
    }

    public void setPhone(String phone) {
        this.phone = phone;
    }

    public String getCode() {
        return code;
    }

    public void setCode(String code) {
        this.code = code;
    }

    public Timestamp getSendTime() {
        return sendTime;
    }

    public void setSendTime(Timestamp sendTime) {
        this.sendTime = sendTime;
    }

    public Timestamp getValidTime() {
        return validTime;
    }

    public void setValidTime(Timestamp validTime) {
        this.validTime = validTime;
    }

    public int getMaxTimes() {
        return maxTimes;
    }

    public void setMaxTimes(int maxTimes) {
        this.maxTimes = maxTimes;
    }
}
